package cn.doctorpda.conference.utils;

import java.text.DecimalFormat;

/**
 * Created by huangjinlong on 2016/5/17.
 */
public class StringUtils {
    public static boolean isEmpty(String s) {
        if (null == s)
            return true;
        if (s.length() == 0)
            return true;
        if (s.trim().length() == 0)
            return true;
        if (("null").equalsIgnoreCase(s.trim())) {
            return true;
        }
        return false;
    }

    //替换指定位置的字符
    public static String replaceIndex(int index, String res, String str) {
        return res.substring(0, index) + str + res.substring(index + 1);
    }

    //保留一位小数
    public static String formatInt(int date) {
        DecimalFormat df = new DecimalFormat("0.0");
        String format = df.format(date);
        return format;
    }
}
